﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace SuperFox
{
    public static class Config
    {
        public const string LOCAL_SERVICE_PATH = "http://localhost:49552/SuperService.svc";
        public const string REMOTE_SERVICE_PATH = "http://superfox.com.au/SuperService.svc";
        public const string REMOTE_SERVICE_PATH_WWW = "http://www.superfox.com.au/SuperService.svc";
        public const string BETA_REMOTE_SERVICE_PATH = "http://beta.superfox.com.au/SuperService.svc";

        public const int SERVICE_MAX_BUFFER_SIZE = 2147483647;
        public const int SERVICE_MAX_RECEIVE_BUFFER_SIZE = 2147483647;

        public const string PRODUCT_IMAGE_DIR = "productimages";

        public const bool IN_DEBUG = false;

        public const int FREE_SHIPPING_CUT_OFF = 10;

        public enum WriteStatusValues { Unchanged, Changed, Saving, Saved };

        public static Color StringToColour(string hex)
        {
            //remove the # at the front
            hex = hex.Replace("#", "");

            byte a = 255;
            byte r = 255;
            byte g = 255;
            byte b = 255;

            int start = 0;

            //handle ARGB strings (8 characters long)
            if (hex.Length == 8)
            {
                a = byte.Parse(hex.Substring(0, 2), System.Globalization.NumberStyles.HexNumber);
                start = 2;
            }

            //convert RGB characters to bytes
            r = byte.Parse(hex.Substring(start, 2), System.Globalization.NumberStyles.HexNumber);
            g = byte.Parse(hex.Substring(start + 2, 2), System.Globalization.NumberStyles.HexNumber);
            b = byte.Parse(hex.Substring(start + 4, 2), System.Globalization.NumberStyles.HexNumber);

            return Color.FromArgb(a, r, g, b);
        }
    }
}
